import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2024-11-05
 * Time:14:52
 */
public class Text {
    public static void main(String[] args) {
        BinaryTree binaryTree=new BinaryTree();
        BinaryTree.TreeNode root=binaryTree.createTree();
        binaryTree.preorderTraversal(root);
        System.out.println();
        binaryTree.inorderTraversal(root);
        System.out.println();
        binaryTree.postorderTraversal(root);
        /*binaryTree.nodeSize(root);
        System.out.println("节点的个数："+binaryTree.size);
        binaryTree.nodeSize2(root);
        System.out.println("节点的个数："+binaryTree.nodeSize2(root));
        binaryTree.getLeafSize(root);
        System.out.println("叶子节点的个数："+binaryTree.leafSize);
        binaryTree.getLeafSize2(root);
        System.out.println("叶子节点的个数："+binaryTree.getLeafSize2(root));
        binaryTree.getKLevelNodeCount(root,3);
        System.out.println("第K层节点的个数："+binaryTree.getKLevelNodeCount(root,3));
        binaryTree.getKLevelNodeCount(root,3);
        System.out.println("树的高度："+binaryTree.getHeight(root));
        boolean flg= binaryTree.find(root,'D');
        if(flg==true){
            System.out.println("找到了这个节点");
        }else {
            System.out.println("没有找到");
        }
        binaryTree.levelOrder(root);
        System.out.println();
        boolean flag= binaryTree.isCompleteTree(root);
        System.out.println(flag);*/
        /*System.out.println("=======");
        binaryTree.preOrder(root);
        System.out.println();
        System.out.println("========");
        binaryTree.inOrder(root);
        System.out.println();
        System.out.println("========");
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("========");*/
        /*//循环打印
        List<BinaryTree.TreeNode> ret=binaryTree.preOrder2(root);;
        for (BinaryTree.TreeNode x:ret) {
            System.out.print(x.val+" ");
        }
        System.out.println();
        System.out.println("========");
        ret=binaryTree.inOrder2(root);
        for (BinaryTree.TreeNode x:ret) {
            System.out.print(x.val+" ");
        }
        System.out.println();
        System.out.println("========");
        ret=binaryTree.postOrder2(root);
        for (BinaryTree.TreeNode x:ret) {
            System.out.print(x.val+" ");
        }
        System.out.println();
        System.out.println("========");*/
    }
}
